home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / e_to_l / greport2 / greport.int < prev    next >
Text File  |  1996-09-15  |  6KB  |  159 lines

  1. unit Greport;
  2. interface
  3. { $define debugmode}
  4. {$define unregistered}
  5.  
  6. uses
  7.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  8.   Forms, Dialogs, mltools, printers, DBtables, stdctrls;
  9.  
  10. type
  11.   TGraphicReportItem = class;
  12.   TGraphicReportPageMultiplier = class;
  13.   TGraphicReportSimpleObject = class;
  14.   TGraphicReportSQLTable = class;
  15.   TGraphicReportGroup = class;
  16.   TGraphicReport = class;
  17.  
  18. { ************************************************************************* }
  19. { * TGraphicReportItem                                                    * }
  20. { ************************************************************************* }
  21.  
  22.   TGraphicReportItem = class(TComponent)
  23.   public
  24.     report:tgraphicreport;
  25.     procedure beginprinting; virtual;
  26.     procedure printapage(x,y:integer); virtual;
  27.     procedure endprinting; virtual;
  28.     function hasnextpage:boolean; virtual;
  29.   end;
  30.  
  31. { ************************************************************************* }
  32. { * TGraphicReportPageMultiplier                                          * }
  33. { ************************************************************************* }
  34.  
  35.   TGraphicReportPageMultiplier = class(TGraphicReportItem)
  36.   private
  37.     thispage:integer;
  38.   public
  39.     numpages:string;
  40.     procedure beginprinting; override;
  41.     procedure printapage(x,y:integer); override;
  42.     function hasnextpage:boolean; override;
  43.   end;
  44.  
  45. { ************************************************************************* }
  46. { * TGraphicReportSimpleObject                                            * }
  47. { ************************************************************************* }
  48.  
  49.   TGraphicReportSimpleObject = class(TGraphicReportItem)
  50.   public
  51.     typ:string[40];
  52.     params:string;
  53.     procedure printapage(x,y:integer); override;
  54.   end;
  55.  
  56. { ************************************************************************* }
  57. { * TGraphicReportSQLTable                                        * }
  58. { ************************************************************************* }
  59.  
  60.   TGraphicReportSQLTable=class(TGraphicReportItem)
  61.   private
  62.     constructor create(aowner:tcomponent); override;
  63.     destructor destroy; override;
  64.   public
  65.     query:tquery;
  66.     xorigin,
  67.     yorigin,
  68.     width,
  69.     height:integer;
  70.     groupstr:array[0..9] of string;
  71.     groupstrvalue:array[0..9] of string;
  72.     grouptops:array[0..9] of tgraphicreportgroup;
  73.     ingroup:array[0..9] of boolean;
  74.     groupbottoms:array[0..9] of tgraphicreportgroup;
  75.     firstpagetop,
  76.     pagetop,
  77.     reporttop,
  78.     detailarea,
  79.     reportbottom,
  80.     pagebottom:tgraphicreportgroup;
  81.     grouptopheights:array[0..9] of integer;
  82.     groupbottomheights:array[0..9] of integer;
  83.     firstpagetopheight,
  84.     pagetopheight,
  85.     reporttopheight,
  86.     detailareaheight,
  87.     reportbottomheight,
  88.     pagebottomheight:integer;
  89.     status:byte;
  90.     pagenumber:integer;
  91.     procedure readfromstream(stream:tstream); virtual;
  92.     procedure setvariables; virtual;
  93.     procedure beginprinting; override;
  94.     procedure printapage(x,y:integer); override;
  95.     procedure endprinting; override;
  96.     function hasnextpage:boolean; override;
  97.   end;
  98.  
  99. { ************************************************************************* }
  100. { * TGraphicReportGroup                                                   * }
  101. { ************************************************************************* }
  102.  
  103.   TGraphicReportGroup = class(TGraphicReportItem)
  104.   public
  105.     xorigin,yorigin:integer;
  106.     procedure readfromstream(stream:tstream); virtual;
  107.     procedure insertobjectstring(stream:tstream; cmd,params:string); virtual;
  108.     procedure beginprinting; override;
  109.     procedure printapage(x,y:integer); override;
  110.     procedure endprinting; override;
  111.     function hasnextpage:boolean; override;
  112.   end;
  113.  
  114. { ************************************************************************* }
  115. { * TGraphicReport                                                        * }
  116. { ************************************************************************* }
  117.  
  118.   TReportProgressProc=procedure(Sender:TObject; Info:String) of object;
  119.   TReportEventProc=procedure(Sender:TObject; Params:String) of object;
  120.  
  121.   TGraphicReport = class(TComponent)
  122.   protected
  123.     freportfile:string;
  124.     fvariables:tstrings;
  125.     fonreportprogress:treportprogressproc;
  126.     fonreportevent:treporteventproc;
  127.     dialog:tform;
  128.     infolabel:tlabel;
  129.     constructor create(aowner:tcomponent); override;
  130.     destructor destroy; override;
  131.     procedure setvariables(value:tstrings);
  132.     procedure setinitialvariables;
  133.     procedure reportprogress(info:string);
  134.     procedure reportevent(params:string);
  135.     procedure showdialog;
  136.     procedure hidedialog;
  137.   public
  138.     fontfaktor:real;
  139.     procedure setvariable(name,info:string);
  140.     function getvariable(name:string):string;
  141.     function getnumberfloat(formel:string):real;
  142.     function getnumberinteger(formel:string):longint;
  143.     function getstring(formel:string):string;
  144.     procedure printtestpage;
  145.     procedure execute;
  146.   published
  147.     property ReportFile:String read freportfile write freportfile;
  148.     property Variables:TStrings read fvariables write setvariables;
  149.     property OnReportProgress:TReportProgressProc read fonreportprogress
  150.                                                   write fonreportprogress;
  151.     property OnReportEvent:TReportEventProc read fonreportevent
  152.                                             write fonreportevent;
  153.   end;
  154.  
  155. procedure Register;
  156.  
  157. implementation
  158.  
  159.